package org.wangwei.worker;

import java.util.HashMap;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.CopyOnWriteArrayList;

public class ConfigurableWorker implements Runnable, LifeCycle {

	private BlockingQueue<WorkerTask<?>> taskQueue = new ArrayBlockingQueue<>(5);
	private Thread thread;
	private HashMap<WorkerEvent, CopyOnWriteArrayList<WorkerListener>> listenerMap;
	private volatile boolean initated = false;
	private String workerId;

	public ConfigurableWorker(String workId) {
		this.workerId = workerId;
	}

	@Override
	public void start() {
		if (!initated) {
			init();
		}

		thread.start();
	}

	@Override
	public void init() {
		if (initated) {
			return;
		}

	}

	@Override
	public void stop() {
		thread.interrupt();
	}

	@Override
	public void run() {
		// TODO Auto-generated method stub

	}

}
